package com.sjb.sixteen_journey_backend.controller;


import com.sjb.sixteen_journey_backend.common.R;
import com.sjb.sixteen_journey_backend.service.IFollowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * 关注与粉丝表
 *
 * @author jcz
 * @since 2024-07-16
 */
@RestController
@RequestMapping("/follower")
public class FollowerController {
    @Autowired
    private IFollowerService followerService;

    /**
     * 关注或者取消关注用户
     * @param id 被关注用户的id号
     * @return
     */
    @GetMapping("/followerUser/{id}")
    public R followerUser(@PathVariable("id") Integer id){
        return followerService.followerUser(id);
    }

    /**
     * 获取关注列表
     * @return
     */
    @GetMapping("/getFollower")
    public R getFollower(){
        return followerService.getFollower();
    }

    /**
     * 获取粉丝列表
     * @return
     */
    @GetMapping("/getFans")
    public R getFans(){
        return followerService.getFans();
    }

    /**
     * D圈模块中的关注模块
     * @return 按照时间排序的所有关注者的所有动态
     */
    @GetMapping("/getDCircleByFollower")
    public <T>R getDCircleByFollower() throws IOException {
        return followerService.getDCircleByFollower();
    }
}
